// 通用启动入口

import Vue from 'vue'
import App from './App.vue'
import createRouter from  './router/index'
import { createStore } from './store'

import VueMeta from 'vue-meta'
Vue.use(VueMeta, {
  // optional pluginOptions
  refreshOnceOnNavigation: true
})

Vue.mixin({
  metaInfo: {
    title: 'My Example App',
    // titleTemplate: '%s - Yay!',
    htmlAttrs: {
      lang: 'en',
      amp: true
    }
  },
})

export function createApp() {
  // 每次返回一个新的实例,避免多个客户端访问,返回的是同一个页面数据模板
  const router = createRouter()
  const store = createStore()
  const app = new Vue({
    router,
    store,
    render: h => h(App)
  })
  return {app , router, store}
}